package com.woniu.p2p.controller;

import com.github.pagehelper.PageInfo;
import com.woniu.p2p.service.MydepositsHistoryService;
import com.woniu.p2p.vo.MydepositsHistoryVo;
import com.woniu.p2p.vo.MydepositsPageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/depositsHistory")
public class P2PMydepositsHistoryController {

    @Autowired
    MydepositsHistoryService mydepositsHistoryService;

    @RequestMapping("/xin")
    public PageInfo<MydepositsHistoryVo> findAllDepositsXin(@RequestBody MydepositsPageInfoVo mydepositsPageInfoVo, HttpServletRequest request){
        String token = request.getHeader("token");
        int i = Integer.parseInt(token);
        //这个是类别id
        Integer currentPage = mydepositsPageInfoVo.getCurrentPage();
        Integer typeId = mydepositsPageInfoVo.getTypeId();
        System.out.println(typeId);
        PageInfo<MydepositsHistoryVo> pageInfo = mydepositsHistoryService.findAllDepositsByUserIdAndInvestId(i, typeId, currentPage);
        return pageInfo;
    }

}
